/*
 *  (C) Copyright 2007 Insula Tecnologia da Informacao Ltda.
 * 
 *  This file is part of Jazz.
 *
 *  Jazz is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Jazz is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Jazz.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.openinsula.jazz.binding;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.List;

import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ContextConfiguration(locations = { "/test-context.xml", "classpath*:META-INF/*-context.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class BindingAnnotationBeanPostProcessorTestCase {

	@Autowired
	private BindingProvider bindingProvider;

	@Test
	public void testGetBindingAttributes() {
		List<BindingAttribute> bindingAttributes = bindingProvider.getBindingAttributes();

		assertEquals(4, bindingAttributes.size());
		assertTrue(bindingAttributes.get(0).getField() instanceof JTextField);
		assertTrue(bindingAttributes.get(1).getField() instanceof JLabel);
		assertTrue(bindingAttributes.get(2).getField() instanceof JCheckBox);
		assertTrue(bindingAttributes.get(3).getField() instanceof JRadioButton);
	}

}
